]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionPrefs: Include more extension details in expander
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 30 Nov 2019 17:11:03 +0000 (18:11 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 3 Feb 2020 18:11:21 +0000 (19:11 +0100)
The newly added expander gives us a place where we can display
more details without cluttering the interface.

Take advantage of that by including the extension website, version
and author.

(Author is in the mockups, but will not actually be shown until
the extensions website is changed to include it in its metadata;
however best to have UI and string in place for the freezes)

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1968

js/extensionPrefs/main.js
js/extensionPrefs/ui/extension-row.ui

index 99dfddd9f22b12d303a535a5347399e0eb509c6c..e2babfe62f23bd71690f647bf76a4a4d59aa2cd4 100644 (file)
@@ -290,7 +290,7 @@ var ExtensionsWindow = GObject.registerClass({
             label: _("Homepage"),
             tooltip_text: _("Visit extension homepage"),
             no_show_all: true,
-            visible: row.url != null,
+            visible: row.url !== '',
         });
         toolbar.add(urlButton);
 
@@ -483,6 +483,8 @@ var ExtensionRow = GObject.registerClass({
     InternalChildren: [
         'nameLabel',
         'descriptionLabel',
+        'versionLabel',
+        'authorLabel',
         'revealButton',
         'revealer',
     ],
@@ -505,6 +507,16 @@ var ExtensionRow = GObject.registerClass({
         action.connect('activate', () => this.get_toplevel().openPrefs(this.uuid));
         this._actionGroup.add_action(action);
 
+        action = new Gio.SimpleAction({
+            name: 'show-url',
+            enabled: this.url !== '',
+        });
+        action.connect('activate', () => {
+            Gio.AppInfo.launch_default_for_uri(
+                this.url, this.get_display().get_app_launch_context());
+        });
+        this._actionGroup.add_action(action);
+
         action = new Gio.SimpleAction({
             name: 'enabled',
             state: new GLib.Variant('b', false),
@@ -562,8 +574,16 @@ var ExtensionRow = GObject.registerClass({
         return this._extension.hasPrefs;
     }
 
+    get creator() {
+        return this._extension.metadata.creator || '';
+    }
+
     get url() {
-        return this._extension.metadata.url;
+        return this._extension.metadata.url || '';
+    }
+
+    get version() {
+        return this._extension.metadata.version || '';
     }
 
     _updateState() {
@@ -572,6 +592,12 @@ var ExtensionRow = GObject.registerClass({
         let action = this._actionGroup.lookup('enabled');
         action.set_state(new GLib.Variant('b', state));
         action.enabled = this._canToggle();
+
+        this._versionLabel.label = `${this.version}`;
+        this._versionLabel.visible = this.version !== '';
+
+        this._authorLabel.label = `${this.creator}`;
+        this._authorLabel.visible = this.creator !== '';
     }
 
     _onDestroy() {
index 23231e2b91b0210c97a895c78de1cd192e7c2e11..0ec50802ea58220f59365ff7422f55237470136f 100644 (file)
                     <property name="yalign">0</property>
                   </object>
                 </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible"
+                              bind-source="versionLabel"
+                              bind-property="visible"
+                              bind-flags="sync-create"/>
+                    <property name="no_show_all">True</property>
+                    <property name="label" translatable="yes">Version</property>
+                    <property name="xalign">0</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="versionLabel">
+                    <property name="no_show_all">True</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible"
+                              bind-source="authorLabel"
+                              bind-property="visible"
+                              bind-flags="sync-create"/>
+                    <property name="no_show_all">True</property>
+                    <property name="label" translatable="yes">Author</property>
+                    <property name="xalign">0</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="authorLabel">
+                    <property name="no_show_all">True</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Website</property>
+                    <property name="action_name">row.show-url</property>
+                    <property name="valign">end</property>
+                    <property name="margin-top">12</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                  </packing>
+                </child>
               </object>
             </child>
           </object>